package cn.zz.camerasdk.filter.ifilter;

/**
 * author: zhu on 2017/7/7 17:24
 * email: mackkill@gmail.com
 */

import android.content.Context;

import cn.zz.camerasdk.utils.MResource;

public class IF1977Filter extends IFImageFilter {
    private static final String SHADER = "precision lowp float;\n \n varying highp vec2 textureCoordinate;\n \n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2;\n \n void main()\n {\n     \n     vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;\n     \n     texel = vec3(\n                  texture2D(inputImageTexture2, vec2(texel.r, .16666)).r,\n                  texture2D(inputImageTexture2, vec2(texel.g, .5)).g,\n                  texture2D(inputImageTexture2, vec2(texel.b, .83333)).b);\n     \n     gl_FragColor = vec4(texel, 1.0);\n }\n";

    public IF1977Filter(Context paramContext) {
        super(paramContext, "precision lowp float;\n \n varying highp vec2 textureCoordinate;\n \n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2;\n \n void main()\n {\n     \n     vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;\n     \n     texel = vec3(\n                  texture2D(inputImageTexture2, vec2(texel.r, .16666)).r,\n                  texture2D(inputImageTexture2, vec2(texel.g, .5)).g,\n                  texture2D(inputImageTexture2, vec2(texel.b, .83333)).b);\n     \n     gl_FragColor = vec4(texel, 1.0);\n }\n");
        this.setRes(paramContext);
    }

    private void setRes(Context context) {
        int resId1 = MResource.getIdByName(context, "drawable", "nmap");
        int resId2 = MResource.getIdByName(context, "drawable", "nblowout");
        this.addInputTexture(resId1);
        this.addInputTexture(resId2);
    }
}
